package com.hangzhou.xyj.utils;

import com.hangzhou.xyj.XYJApplication;

import android.content.Context;
import android.net.ConnectivityManager;


/**
 * Created by neo.duan on 2015/09/08
 */
public class NetworkUtil {
    public static boolean isNetworkConnect(){
        if(XYJApplication.mAppContext == null){
            return false;
        }
        ConnectivityManager connectivityManager= (ConnectivityManager)XYJApplication.mAppContext.getSystemService(Context.CONNECTIVITY_SERVICE);
        if(connectivityManager!=null) {
            if(connectivityManager.getActiveNetworkInfo()!=null && connectivityManager.getActiveNetworkInfo().isConnected()){
                return true;
            }
        }
        return false;
    }
}
